# Set-up Conda
# source ~/.bashrc

RDS=$1
NCPU=$2
ID=$3
param=$4
if [ -z $param ]; then
	param=32
fi
MAT=/mnt/data2/zhangyiming/F1000Imputation/TemporaryFileDir/counts_$ID.csv
OUT=/mnt/data2/zhangyiming/F1000Imputation/TemporaryFileDir/$ID
mkdir -p $OUT

echo "Extract"
Rscript extract_count_mat.R $RDS $MAT

# conda activate dca2

echo "DCA"
dca --threads=$NCPU -s 64,$param,64 $MAT $OUT

echo "Add"
Rscript add_count_mat.R $RDS $OUT/mean.tsv "dca"

# clean-up
# rm $MAT
# rm -r $OUT
